package com.dtx.demo1;

public class Animal {

    public Integer age;
    public String name;

    public void walk(){
        System.out.println("动物走路");
    }

    public void eat(){
        System.out.println("动物吃东西");
    }

    public void func(Animal animal){
        animal.eat();;
        animal.walk();
    }

    public void behaving(Animal animal){
        func(animal);
    }

    public static void main(String[] args) {
        Animal animal = new Person();
        Class<? extends Animal> c1 = animal.getClass();
        System.out.println(c1.getName());
        animal.func(animal);
    }

}

class Person extends Animal{

    @Override
    public void eat() {
        System.out.println("人类吃东西");
    }

    @Override
    public void walk() {
        System.out.println("人类走路");
    }
}
